package com.ht.safe.entity;

import org.hibernate.annotations.Index;
import org.springframework.data.jpa.domain.AbstractPersistable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.OneToMany;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @author: 薄成文 13-7-19 上午10:43
 * To change this template use File | Settings | File Templates.
 */
public class MemberGroup extends AbstractPersistable<Integer> {

    @Column(unique = true, nullable = false)
    @Index(name="idx_memebergroup_name")
    private String name;

    @Column(unique = true, nullable = false)
    @Index(name="idx_memebergroup_code")
    private String code;

    @OneToMany(cascade = CascadeType.DETACH, mappedBy = "memberGroup")
    private List<Member> members;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public List<Member> getMembers() {
        return members;
    }

    public void setMembers(List<Member> members) {
        this.members = members;
    }
}
